package com.baizhi.webController;

import com.baizhi.entrty.Album;
import com.baizhi.entrty.Banner;
import com.baizhi.service.AlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//标记为控制器类
@RestController
@RequestMapping("appalbum")
public class AlbumWebController {
    @Autowired
    private AlbumService as;

    @GetMapping("showAlbum")
    public List<Album> showAlbum(){
        List<Album> albums = as.showAll();

        return albums;

    }

    @GetMapping("showOne/{albumId}")
    public Album showOne(@PathVariable("albumId") int albumId){
        Album showOne = as.showOne(albumId);
        return showOne;
    }

    @GetMapping("showList/{albumId}")
    public Album showList(@PathVariable("albumId") int albumId){
        Album showList = as.showList(albumId);
        return showList;
    }
}
